﻿using System;
using System.Runtime.InteropServices;
using SpeedikonCom;
using System.Xml.Serialization;
using System.Collections.Generic;

namespace SOM.Lists
	{
  [ComDefaultInterface(typeof(SOM.Interfaces.Lists.IWallList)), ClassInterface(ClassInterfaceType.None)]
  [ComSourceInterfaces(typeof(SOM.Interfaces.Lists.IWallList))]
  [Serializable()]
  public class WallList : List<SOM.Objects.Wall>, SOM.Interfaces.Lists.IWallList
  {
    #region Typen-Konstanten
    [ComVisible(false)]
    const string sWandName = "Wand";
    [ComVisible(false)]
    const string sWandZellName = "WALL__";

    [ComVisible(false)]
    const string sOeffnungName = "Oeffnung";
    [ComVisible(false)]
    const string sOeffnungZellName = "Opening";

    [ComVisible(false)]
    const string sObjektName = "Objekt";
    [ComVisible(false)]
    const string sObjektZellName = "COMPON";

    [ComVisible(false)]
    const string sDachName = "Dach";
    [ComVisible(false)]
    const string sDachZellName = "ROOF__";

    [ComVisible(false)]
    const string sRaumName = "Raum";
    [ComVisible(false)]
    const string sRaumZellName = "space_";

    [ComVisible(false)]
    const string sStuetzeName = "Stuetze";
    [ComVisible(false)]
    const string sStuetzeZellName = "COLUMN";

    [ComVisible(false)]
    const string sUnterzugName = "Unterzug";
    [ComVisible(false)]
    const string sUnterzugZellName = "BEAM__";
    #endregion


    #region globale Variablen
    [ComVisible(false)]
    Dictionary<string, int> ldObjektTyp = new Dictionary<string, int>();
    [ComVisible(false)]
    List<string> scObjektName = new List<string>();
    [ComVisible(false)]
    Dictionary<string, string> sdObjektZellName = new Dictionary<string, string>();
    [ComVisible(false)]
    Dictionary<string, Dictionary<string, string>> sddObjektAttribut = new Dictionary<string, Dictionary<string, string>>();
    #endregion

    public void SendToDatabase(string server, string table, string SchemeFilePath = "")
    {
      SOM.Helper.Methods.SendToDatabase<SOM.Objects.Wall>(this, server,table,SchemeFilePath);
    }
    public void GetFromDatabase(string server, string table, string SchemeFilePath = "")
    {
      var tmp = (SOM.Interfaces.Lists.IWallList)SOM.Helper.Methods.GetFromDatabase<SOM.Objects.Wall>(server,-1, table,SchemeFilePath);
      foreach (System.Reflection.PropertyInfo p in this.GetType().GetProperties())
      {
        try { this.GetType().GetProperty(p.Name).SetValue(this, tmp.GetType().GetProperty(p.Name).GetValue(tmp, null), null); }
        catch { }
      }
    }

    private Dictionary<string, int> dParamInt = new Dictionary<string, int>();
    private Dictionary<string, int[]> dParamIntA = new Dictionary<string, int[]>();
    private Dictionary<string, double[]> dParamDoubleA = new Dictionary<string, double[]>();
    private Dictionary<string, double> dParamDouble = new Dictionary<string, double>();
    private Dictionary<string, string> dParamText = new Dictionary<string, string>();
    private Dictionary<string, string[]> dParamTextA = new Dictionary<string, string[]>();
    private Dictionary<string, int> dParamSwitch = new Dictionary<string, int>();


    [ComVisible(true)]
    public SOM.Interfaces.Objects.IWall GetWall(int index)
    {
      return this[index];
    }

    [ComVisible(true)]
    public SOM.Interfaces.Objects.IWall GetWallFromID(int ID)
    {
      foreach (SOM.Objects.Wall w in this)
      {
        if (w.ID == ID)
        {
          return w;
        }
      }
      return null;
    }



    #region COM-GUIDs
    // Diese GUIDs stellen die COM-Identität für diese Klasse 
    // und ihre COM-Schnittstellen bereit. Wenn Sie sie ändern, können vorhandene 
    // Clients nicht mehr auf die Klasse zugreifen.
    [ComVisible(false)]
    public const string ClassId = "28de06fd-791a-4c45-b8c0-2a768f676fe3";
    [ComVisible(false)]
    public const string InterfaceId = "1b67516d-6100-4747-b28e-1cab57ec620b";
    [ComVisible(false)]
    public const string EventsId = "1839a07d-acd8-47e9-b051-58f0487fa4b9";
    #endregion



    /// <summary>
    /// Erstellt ein neues CNT Objekt (zZ Wandliste)
    /// </summary>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <remarks></remarks>
    public WallList()
    {
      //base.Clear; = new List<SOM.Objects.Wall>();
      //initWand();
      //				initDach();
      //				initObjekt();
      //				initOeffnung();
      //				initRaum();
      //				initStuetze();
      //				initUnterzug();
      //scan_Walls()
    }

    /// <summary>
    /// Gibt die Anzahl der gefunden Wände zurück
    /// </summary>
    /// <value>Nur lesbar</value>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <remarks></remarks>
    public new int Count
    {
      get { return base.Count; }
      set
      {

      }
    }



    //private bool _debug;



    /// <summary>
    /// Durchsucht die aktuelle Speedikon Zeichnung nach Wänden und speichert diese als Wand-Objekt in einer internen Liste
    /// </summary>
    /// <param name="pfad">Wird hier ein Pfad übergeben, wird die gesamte Wandliste als XML an dem angegebenen Pfad gespeichert</param>
    /// <param name="full">Gibt an ob alle Informationen oder nur eine "Light" Version davon gespeichert wird</param>
    /// <param name="debug">Führt die Sub im Debugmodus aus</param>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <example><code lang="VB.NET">Dim obj As New elkmenu.helper
    /// Dim wand As New elkmenu.wand
    /// Dim i As integer
    /// obj.ScanWalls
    /// 
    /// For i = 0 to obj.Anzahl - 1
    /// Set wand = obj.GetWall(i)
    /// MsgBox(wand.A_PROTOTYPE)
    /// next
    /// </code></example>
    /// <remarks></remarks>
    public void ScanWalls(string pfad)
    {
      this.Clear();


      IEZ_sp_Attribute cAttribut = new IEZ_sp_Attribute();
      //Dim clFloor As IEZ_sp_Floor
      IEZ_sp_Wall clWall = new IEZ_sp_Wall();
      //Dim clOpening As IEZ_sp_Opening
      //Dim clAttribute As IEZ_sp_Attribute
      IEZ_sp_Object clObject = new IEZ_sp_Object();

      int iCntWalls;
      int[] iIdWalls;

      short iLop;
      int iRet;


      iLop = 0;
      iIdWalls = null;


      clObject.GetList((int)2, out iCntWalls, out  iIdWalls, out iRet);


      if (iCntWalls > 0)
      {

        for (iLop = 0; iLop <= iCntWalls - 1; iLop++)
        {
          SOM.Objects.Wall w = new SOM.Objects.Wall();
          w.LoadWall(iIdWalls[iLop]);
          this.Add(w);
        }
        if (pfad != "")
        {
          string[] tmp = pfad.Split('\\');
          if (System.IO.Directory.Exists(pfad.Substring(0, pfad.Length - tmp[tmp.GetUpperBound(0)].Length)))
          {

            this.Serialisieren(pfad);

          }
          else
          {
            throw new Exception("Pfad nicht gefunden!");

          }
        }
      }
    }




    /// <summary>
    /// Initialisiert die globalen Variablen für das Durchsuchen von Dachelementen
    /// </summary>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <remarks></remarks>
    //			[ComVisible(false)]
    //			internal void initDach()
    //			{
    //				//Dim lDachId As integer
    //				
    //				Dictionary<string, string> dcDachAttribut = new Dictionary<string, string>();
    //				
    //				dcDachAttribut.Add("Double_1", "A_thermal_transmittance");
    //				
    //				dcDachAttribut.Add("integer_1", "A_assoc_auto");
    //				dcDachAttribut.Add("integer_2", "A_sound_reduction");
    //				dcDachAttribut.Add("integer_3", "C_ELEMENT_NUMBER");
    //				
    //				dcDachAttribut.Add("string_1", "A_CATEGORY");
    //				dcDachAttribut.Add("string_2", "A_ELEMENTCODE");
    //				dcDachAttribut.Add("string_3", "A_ELEMENTDESC");
    //				dcDachAttribut.Add("string_4", "A_FIRECLASS");
    //				dcDachAttribut.Add("string_5", "A_PROTOTYPE");
    //				
    //				
    //				
    //				ldObjektTyp.Add(sDachName, enums.ObjektTypen.Dach);
    //				sdObjektZellName.Add(sDachName, sDachZellName);
    //				sddObjektAttribut.Add(sDachName, dcDachAttribut);
    //				
    //			}

    /// <summary>
    /// Initialisiert die globalen Variablen für das Durchsuchen von Objektelementen
    /// </summary>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <remarks></remarks>
    //			[ComVisible(false)]
    //			internal void initObjekt()
    //			{
    //				//Dim lObjektId As integer
    //				
    //				
    //				Dictionary<string, string> dcObjektAttribut = new Dictionary<string, string>();
    //				
    //				dcObjektAttribut.Add("Double_1", "Offset");
    //				
    //				dcObjektAttribut.Add("integer_1", "A_CONNECT");
    //				dcObjektAttribut.Add("integer_2", "A_TYPE");
    //				dcObjektAttribut.Add("integer_3", "COMP_ED_NUMMER");
    //				dcObjektAttribut.Add("integer_4", "A_CONSTRUCTION");
    //				
    //				dcObjektAttribut.Add("string_1", "A_CATEGORY");
    //				dcObjektAttribut.Add("string_2", "A_ELEMENTCODE");
    //				dcObjektAttribut.Add("string_3", "A_ELEMENTDESC");
    //				dcObjektAttribut.Add("string_4", "A_FIRECLASS");
    //				dcObjektAttribut.Add("string_5", "A_PROTOTYPE");
    //				dcObjektAttribut.Add("string_6", "A_USE");
    //				
    //				
    //				
    //				ldObjektTyp.Add(sObjektName, enums.ObjektTypen.Objekt);
    //				sdObjektZellName.Add(sObjektName, sObjektZellName);
    //				sddObjektAttribut.Add(sObjektName, dcObjektAttribut);
    //				
    //			}

    /// <summary>
    /// Initialisiert die globalen Variablen für das Durchsuchen von Öffnungselementen
    /// </summary>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <remarks></remarks>
    //			[ComVisible(false)]
    //			internal void initOeffnung()
    //			{
    //				//Dim lOeffnungId As integer
    //				
    //				
    //				Dictionary<string, string> dcOeffnungAttribut = new Dictionary<string, string>();
    //				
    //				dcOeffnungAttribut.Add("Double_1", "A_OFFSET_TOP");
    //				dcOeffnungAttribut.Add("Double_2", "A_thermal_transmittance");
    //				
    //				dcOeffnungAttribut.Add("integer_1", "A_CONNECT");
    //				dcOeffnungAttribut.Add("integer_2", "A_CONSTRUCTION");
    //				dcOeffnungAttribut.Add("integer_3", "A_DOOR_TYPE");
    //				dcOeffnungAttribut.Add("integer_4", "A_element_mac_hole_closure_bymacro");
    //				dcOeffnungAttribut.Add("integer_5", "A_element_mac_hole_elev_bymacro");
    //				dcOeffnungAttribut.Add("integer_6", "A_element_user_number");
    //				dcOeffnungAttribut.Add("integer_7", "A_LEVELID_BOTTOM_DIM");
    //				dcOeffnungAttribut.Add("integer_8", "A_LEVELID_TOP");
    //				dcOeffnungAttribut.Add("integer_9", "A_LEVELID_TOP_DIM");
    //				dcOeffnungAttribut.Add("integer_10", "A_offset_top_lock");
    //				dcOeffnungAttribut.Add("integer_11", "A_positioning_type");
    //				dcOeffnungAttribut.Add("integer_12", "A_section_mode");
    //				dcOeffnungAttribut.Add("integer_13", "A_sound_reduction");
    //				
    //				dcOeffnungAttribut.Add("string_1", "A_CATEGORY");
    //				dcOeffnungAttribut.Add("string_2", "A_ELEMENTCODE");
    //				dcOeffnungAttribut.Add("string_3", "A_ELEMENTDESC");
    //				dcOeffnungAttribut.Add("string_4", "A_FIRECLASS");
    //				dcOeffnungAttribut.Add("string_5", "A_MACRONAME");
    //				dcOeffnungAttribut.Add("string_6", "A_PROTOTYPE");
    //				
    //				
    //				
    //				ldObjektTyp.Add(sOeffnungName, enums.ObjektTypen.Öffnung);
    //				sdObjektZellName.Add(sOeffnungName, sOeffnungZellName);
    //				sddObjektAttribut.Add(sOeffnungName, dcOeffnungAttribut);
    //				
    //			}

    /// <summary>
    /// Initialisiert die globalen Variablen für das Durchsuchen von Raumlementen
    /// </summary>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <remarks></remarks>
    //			[ComVisible(false)]
    //			internal void initRaum()
    //			{
    //				//Dim lRaumId As integer
    //				
    //				Dictionary<string, string> dcRaumAttribut = new Dictionary<string, string>();
    //				
    //				dcRaumAttribut.Add("Double_1", "A_BASE_OFFSET");
    //				dcRaumAttribut.Add("Double_2", "A_DEAD_LOAD");
    //				dcRaumAttribut.Add("Double_3", "A_HEIGHT");
    //				dcRaumAttribut.Add("Double_4", "A_PLASTER_THICKNESS");
    //				dcRaumAttribut.Add("Double_5", "A_TOP_OFFSET");
    //				
    //				dcRaumAttribut.Add("DoubleArray_1", "A_SHAPE_POINTX");
    //				dcRaumAttribut.Add("DoubleArray_2", "A_SHAPE_POINTY");
    //				
    //				dcRaumAttribut.Add("integer_1", "A_CONNECT");
    //				dcRaumAttribut.Add("integer_2", "A_FLOOR_FIN_TYPE");
    //				dcRaumAttribut.Add("integer_3", "A_NEDGE");
    //				dcRaumAttribut.Add("integer_4", "A_SLAB_FIN_TYPE");
    //				dcRaumAttribut.Add("integer_5", "A_WALL_FIN_TYPE");
    //				
    //				dcRaumAttribut.Add("string_1", "A_BOUND_KEY");
    //				dcRaumAttribut.Add("string_2", "A_BOUNDARY");
    //				dcRaumAttribut.Add("string_3", "A_CATEGORY");
    //				dcRaumAttribut.Add("string_4", "A_FIN_CATEGORY");
    //				dcRaumAttribut.Add("string_5", "A_GROUP");
    //				dcRaumAttribut.Add("string_6", "A_NAME1");
    //				dcRaumAttribut.Add("string_7", "A_NAME2");
    //				dcRaumAttribut.Add("string_8", "A_NAME3");
    //				dcRaumAttribut.Add("string_9", "A_PROTOTYPE");
    //				dcRaumAttribut.Add("string_10", "A_USE");
    //				dcRaumAttribut.Add("string_11", "A_USE_KEY");
    //				
    //				
    //				
    //				ldObjektTyp.Add(sRaumName, enums.ObjektTypen.Raum);
    //				sdObjektZellName.Add(sRaumName, sRaumZellName);
    //				sddObjektAttribut.Add(sRaumName, dcRaumAttribut);
    //				
    //			}

    /// <summary>
    /// Initialisiert die globalen Variablen für das Durchsuchen von Stützenelementen
    /// </summary>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <remarks></remarks>
    //			[ComVisible(false)]
    //			internal void initStuetze()
    //			{
    //				//Dim lStuetzeId As integer
    //				
    //				Dictionary<string, string> dcStuetzeAttribut = new Dictionary<string, string>();
    //				
    //				dcStuetzeAttribut.Add("Double_1", "A_assoc_ceiling_opening_offset_bottom");
    //				dcStuetzeAttribut.Add("Double_2", "A_assoc_ceiling_opening_offset_left");
    //				dcStuetzeAttribut.Add("Double_3", "A_assoc_ceiling_opening_offset_radius");
    //				dcStuetzeAttribut.Add("Double_4", "A_assoc_ceiling_opening_offset_right");
    //				dcStuetzeAttribut.Add("Double_5", "A_assoc_ceiling_opening_offset_top");
    //				dcStuetzeAttribut.Add("Double_6", "A_assoc_slab_opening_offset_bottom");
    //				dcStuetzeAttribut.Add("Double_7", "A_assoc_slab_opening_offset_left");
    //				dcStuetzeAttribut.Add("Double_8", "A_assoc_slab_opening_offset_radius");
    //				dcStuetzeAttribut.Add("Double_9", "A_assoc_slab_opening_offset_right");
    //				dcStuetzeAttribut.Add("Double_10", "A_assoc_slab_opening_offset_top");
    //				
    //				dcStuetzeAttribut.Add("integer_1", "A_assoc_ceiling_opening_generate");
    //				dcStuetzeAttribut.Add("integer_2", "A_opening_type");
    //				dcStuetzeAttribut.Add("integer_3", "A_assoc_slab_opening_generate");
    //				dcStuetzeAttribut.Add("integer_4", "A_assoc_slab_opening_type");
    //				dcStuetzeAttribut.Add("integer_5", "A_CONSTRUCTION");
    //				dcStuetzeAttribut.Add("integer_6", "A_LEVELID_BOTTOM");
    //				dcStuetzeAttribut.Add("integer_7", "A_LEVELID_TOP");
    //				dcStuetzeAttribut.Add("integer_8", "A_TYPE");
    //				
    //				dcStuetzeAttribut.Add("string_1", "A_CATEGORY");
    //				dcStuetzeAttribut.Add("string_2", "A_ELEMENTCODE");
    //				dcStuetzeAttribut.Add("string_3", "A_ELEMENTDESC");
    //				dcStuetzeAttribut.Add("string_4", "A_FIRECLASS");
    //				dcStuetzeAttribut.Add("string_5", "A_MATERIAL_DESC");
    //				dcStuetzeAttribut.Add("string_6", "A_PROTOTYPE");
    //				dcStuetzeAttribut.Add("string_7", "A_USE");
    //				
    //				
    //				
    //				ldObjektTyp.Add(sStuetzeName, enums.ObjektTypen.Stuetze);
    //				sdObjektZellName.Add(sStuetzeName, sStuetzeZellName);
    //				sddObjektAttribut.Add(sStuetzeName, dcStuetzeAttribut);
    //				
    //			}

    /// <summary>
    /// Initialisiert die globalen Variablen für das Durchsuchen von Unterzugelementen
    /// </summary>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <remarks></remarks>
    //			[ComVisible(false)]
    //			internal void initUnterzug()
    //			{
    //				//Dim lUnterzugId As integer
    //				Dictionary<string, string> dcUnterzugAttribut = new Dictionary<string, string>();
    //				
    //				dcUnterzugAttribut.Add("Double_1", "A_assoc_beam_opening_offset_bottom");
    //				dcUnterzugAttribut.Add("Double_2", "A_assoc_beam_opening_offset_left");
    //				dcUnterzugAttribut.Add("Double_3", "A_assoc_beam_opening_offset_radius");
    //				dcUnterzugAttribut.Add("Double_4", "A_assoc_beam_opening_offset_right");
    //				dcUnterzugAttribut.Add("Double_5", "A_assoc_beam_opening_offset_top");
    //				dcUnterzugAttribut.Add("Double_6", "A_assoc_wall_opening_offset_bottom");
    //				dcUnterzugAttribut.Add("Double_7", "A_assoc_wall_opening_offset_left");
    //				dcUnterzugAttribut.Add("Double_8", "A_assoc_wall_opening_offset_radius");
    //				dcUnterzugAttribut.Add("Double_9", "A_assoc_wall_opening_offset_right");
    //				dcUnterzugAttribut.Add("Double_10", "A_assoc_wall_opening_offset_top");
    //				dcUnterzugAttribut.Add("Double_11", "A_AXIS_OFFSET_FINISH");
    //				dcUnterzugAttribut.Add("Double_12", "A_AXIS_OFFSET_START");
    //				dcUnterzugAttribut.Add("Double_13", "A_GROSS_VOLUME");
    //				dcUnterzugAttribut.Add("Double_14", "A_NET_VOLUME");
    //				
    //				dcUnterzugAttribut.Add("integer_1", "A_assoc_beam_opening_generate");
    //				dcUnterzugAttribut.Add("integer_2", "A_assoc_beam_opening_section_mode");
    //				dcUnterzugAttribut.Add("integer_3", "A_assoc_beam_opening_type");
    //				dcUnterzugAttribut.Add("integer_4", "A_assoc_wall_opening_generate");
    //				dcUnterzugAttribut.Add("integer_5", "A_assoc_wall_opening_type");
    //				dcUnterzugAttribut.Add("integer_6", "A_assoc_wall_opening_section_mode");
    //				dcUnterzugAttribut.Add("integer_7", "A_assoc_wall_opening_type");
    //				dcUnterzugAttribut.Add("integer_8", "A_CONSTRUCTION");
    //				dcUnterzugAttribut.Add("integer_9", "A_LEVELID_TOP");
    //				dcUnterzugAttribut.Add("integer_10", "A_PRIORITY");
    //				dcUnterzugAttribut.Add("integer_11", "A_TYPE");
    //				
    //				dcUnterzugAttribut.Add("string_1", "A_CATEGORY");
    //				dcUnterzugAttribut.Add("string_2", "A_ELEMENTCODE");
    //				dcUnterzugAttribut.Add("string_3", "A_ELEMENTDESC");
    //				dcUnterzugAttribut.Add("string_4", "A_FIRECLASS");
    //				dcUnterzugAttribut.Add("string_5", "A_MATERIAL_DESC");
    //				dcUnterzugAttribut.Add("string_6", "A_PROTOTYPE");
    //				dcUnterzugAttribut.Add("string_7", "A_USE");
    //				
    //				
    //				
    //				ldObjektTyp.Add(sUnterzugName, enums.ObjektTypen.Unterzug);
    //				sdObjektZellName.Add(sUnterzugName, sUnterzugZellName);
    //				sddObjektAttribut.Add(sUnterzugName, dcUnterzugAttribut);
    //				
    //			}

    /// <summary>
    /// Initialisiert die globalen Variablen für das Durchsuchen von Wandelementen
    /// </summary>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <remarks></remarks>
    //[ComVisible(false)]
    //internal void initWand()
    //{
    //    //Dim lID As integer
    //    try {
    //        Dictionary<string, string> dcWandAttribut = new Dictionary<string, string>();

    //        dcWandAttribut.Add("Double_1", "A_AXIS_OFFSET");
    //        dcWandAttribut.Add("Double_2", "A_thermal_transmittance");
    //        dcWandAttribut.Add("Double_3", "I_LENGTH");

    //        dcWandAttribut.Add("DoubleArray_1", "A_LEAF_AXIS_OFFSET");
    //        dcWandAttribut.Add("DoubleArray_2", "A_LEAF_CALCULATED_HEIGHT");
    //        dcWandAttribut.Add("DoubleArray_3", "A_LEAF_HEIGHT");
    //        dcWandAttribut.Add("DoubleArray_4", "A_LEAF_OFFSET_BOTTOM");
    //        dcWandAttribut.Add("DoubleArray_5", "A_LEAF_OFFSET_TOP");
    //        dcWandAttribut.Add("DoubleArray_6", "A_LEAF_WIDTH");
    //        dcWandAttribut.Add("DoubleArray_7", "A_LEAF_Z_BOTTOM");
    //        dcWandAttribut.Add("DoubleArray_8", "A_LEAF_Z_TOP");

    //        dcWandAttribut.Add("Integer_1", "A_assoc_auto");
    //        dcWandAttribut.Add("Integer_2", "A_CONNECT");
    //        dcWandAttribut.Add("Integer_3", "A_CONSTRUCTION");
    //        dcWandAttribut.Add("Integer_4", "A_NUMBEROF_LEAVES");
    //        dcWandAttribut.Add("Integer_5", "A_priority_end");
    //        dcWandAttribut.Add("Integer_6", "A_priority_start");
    //        dcWandAttribut.Add("Integer_7", "A_SEPARATION");
    //        dcWandAttribut.Add("Integer_8", "A_sound_reduction");

    //        dcWandAttribut.Add("IntegerArray_1", "A_LEAF_CALC");
    //        dcWandAttribut.Add("IntegerArray_2", "A_LEAF_LEVELID_BOTTOM");
    //        dcWandAttribut.Add("IntegerArray_3", "A_LEAF_LEVELID_TOP");
    //        dcWandAttribut.Add("IntegerArray_4", "A_LEAF_MATERIAL");
    //        dcWandAttribut.Add("IntegerArray_5", "A_LEAF_NUM_ENDING_END");
    //        dcWandAttribut.Add("IntegerArray_6", "A_LEAF_offset_bottom_lock");
    //        dcWandAttribut.Add("IntegerArray_7", "A_LEAF_offset_top_lock");
    //        dcWandAttribut.Add("IntegerArray_8", "A_LEAF_PRIORITY");
    //        dcWandAttribut.Add("IntegerArray_9", "A_LEAF_PRIORITY_end");
    //        dcWandAttribut.Add("IntegerArray_10", "A_LEAF_PRIORITY_start");
    //        dcWandAttribut.Add("IntegerArray_11", "A_LEAF_USE_ID");

    //        dcWandAttribut.Add("String_1", "A_CATEGORY");
    //        dcWandAttribut.Add("String_2", "A_ELEMENTCODE");
    //        dcWandAttribut.Add("String_3", "A_ELEMENTDESC");
    //        dcWandAttribut.Add("String_4", "A_FIRECLASS");
    //        dcWandAttribut.Add("String_5", "A_PROTOTYPE");
    //        dcWandAttribut.Add("String_6", "A_USE");

    //        dcWandAttribut.Add("StringArray_1", "A_LEAF_CATEGORY");
    //        dcWandAttribut.Add("StringArray_2", "A_LEAF_DESCRIPTION");
    //        dcWandAttribut.Add("StringArray_3", "A_LEAF_ELEMENTCODE");
    //        dcWandAttribut.Add("StringArray_4", "A_LEAF_MAT_DESCRIPTION");
    //        dcWandAttribut.Add("StringArray_5", "A_LEAF_USE");



    //        ldObjektTyp.Add(sWandName, 2);
    //        sdObjektZellName.Add(sWandName, sWandZellName);
    //        sddObjektAttribut.Add(sWandName, dcWandAttribut);
    //    } catch (Exception ex) {
    //        System.Windows.Forms.MessageBox.Show(ex.Message.ToString() + "\n" + ex.Source);

    //    }
    //}



    /// <summary>
    /// Speichert das Objekt in eine XML-Datei
    /// </summary>
    /// <param name="pfad">Vollständiger Pfad zur XML-Datei</param>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <example><code lang="VB.NET">Dim obj As New elkmenu.helper
    /// obj.ScanWalls
    /// 
    /// obj.serialisieren("c:\Test.xml")</code></example>
    /// <remarks></remarks>
    public void Serialisieren(string pfad)
    {

      //object obj = this;
      foreach (SOM.Objects.Wall w in this)
      {
        w.SetPropertiesReadOnly(false);
      }

      XmlSerializer XML = new XmlSerializer(typeof(List<SOM.Objects.Wall>));

      System.IO.FileStream FS = new System.IO.FileStream(pfad, System.IO.FileMode.Create);
      XML.Serialize(FS, this);
      FS.Close();


      //Dim XML As New XmlSerializer(MyBase.GetType)

      //Dim FS As New FileStream(pfad, FileMode.Create)
      //XML.Serialize(FS, obj)
      //FS.Close()
      foreach (SOM.Objects.Wall w in this)
      {
        w.SetPropertiesReadOnly(true);
      }
    }


    /// <summary>
    /// Lädt das Objekt aus einer XML-Datei
    /// </summary>
    /// <param name="pfad">Vollständiger Pfad zur XML-Datei</param>
    /// <author>Steve</author>
    /// <creationdate>02.05.2012</creationdate>
    /// <lasteditedby>Steve</lasteditedby>
    /// <lasteditdate>02.05.2012</lasteditdate>
    /// <example><code lang="VB.NET">Dim obj As New elkmenu.helper
    /// obj.deserialisieren("c:\Test.xml")
    /// 
    /// Dim w As New elkmenu.wand
    /// 
    /// For i = 0 to obj.Anzahl - 1
    /// Set w = obj.GetWall(i)
    /// MsgBox(wand.A_PROTOTYPE)
    /// next</code></example>
    /// <remarks></remarks>
    public bool Deserialisieren(string pfad)
    {
      bool ret = true;
      Type T = base.GetType();



      XmlSerializer XML = new XmlSerializer(T);
      System.IO.FileStream fs = new System.IO.FileStream(pfad, System.IO.FileMode.Open);
      try
      {
        Object obj = XML.Deserialize(fs);
        this.Clear();
        foreach (SOM.Objects.Wall w in (List<SOM.Objects.Wall>)obj)
        {
          this.Add(w);
        }
        //foreach (System.Reflection.PropertyInfo eigenschaft in obj.GetType().GetProperties())
        //{
        //  if (eigenschaft.CanWrite)
        //  {
        //    this.GetType().GetProperty(eigenschaft.Name).SetValue(this, this.GetType().GetProperty(eigenschaft.Name).GetValue(obj, null), null);
        //  }
        //}
      }
      catch (Exception ex)
      {
        ret = false;
        System.Windows.Forms.MessageBox.Show("Fehler in der Datenstruktur! " + ex.Message);
      }
      finally
      {
        fs.Close();
      }

      return ret;


    }

  }

}
